package com.mano.mall.common.mapper;

import java.util.List;

import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.impl.DefaultMapperFactory;


public class MapperUtils {
	static MapperFactory mapperFactory;
	static {
		mapperFactory = new DefaultMapperFactory.Builder().build();
	}

	/**
	 * Mapper 映射 List  DTO
	 * @param source
	 * @param destinationClass
	 * @param <S>
	 * @param <D>
	 * @return
	 */
	public static <S, D> List<D> mapAsList(Iterable<S> source, Class<D> destinationClass) {
		return mapperFactory.getMapperFacade().mapAsList(source, destinationClass);
	}
}
